package net.medplus.social.weixin;

/**
 * Description:
 *
 * @author: Xian XueLiang
 * @date: 2016/6/12
 */
final class Utils {
    private Utils() {
        // No instances.
    }

    static <T> T checkNotNull(T object, String message) {
        if (object == null) {
            throw new NullPointerException(message);
        }
        return object;
    }

//    static <T> void validateServiceInterface(Class<T> service) {
//        if (!service.isInterface()) {
//            throw new IllegalArgumentException("API declarations must be interfaces.");
//        }
//        // Prevent API interfaces from extending other interfaces. This not only avoids a bug in
//        // Android (http://b.android.com/58753) but it forces composition of API declarations which is
//        // the recommended pattern.
//        if (service.getInterfaces().length > 0) {
//            throw new IllegalArgumentException("API interfaces must not extend other interfaces.");
//        }
//    }
    static <T> void validateServiceInterface(Class<T> service){
        if (!service.isInterface()) {
            throw new IllegalStateException("API declarations must be interfaces.");
        }
        if (service.getInterfaces().length>0) {
            throw new IllegalStateException("API interfaces must not extend other interfaces.");
        }
    }

}
